<template>
		<i :class="'icon-button-default '+componentModel.iconClass" :style="componentModel.cssStyle" @click="onClickHandler()"></i>
</template>

<script>
	import {sendComponentEventRequest} from '@/utils/requestUtils.js';
	import utils from '@/utils/utils.js';
	export default {
		name:"IconComponent",
		props:["componentModel","data"],
		data() {
			return {
				cssStyle:"",
			}
		},methods:{
			setProp() {
				
			},
			onClickHandler(){
				var that=this;
				if(this.data!=undefined){
					if(this.componentModel.confirmMessage!=undefined){
						this.$confirm(this.componentModel.confirmMessage, '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(() => {
							var table=utils.getTableComponent(this);
							sendComponentEventRequest(that,"clickEvent",{"id":this.data[table.componentModel.keyColumnName]});
						}).catch(() => {
						
						});
					}else{
						var table=utils.getTableComponent(this);
						sendComponentEventRequest(this,"clickEvent",{"id":this.data[table.componentModel.keyColumnName]});
					}
				}
			}
		}
	}
</script>

<style>
	.icon-button-default{
		width: 24px;
		height: 24px;
		cursor: pointer;
		color: #FF4D51;
	}
</style>
